/*
 * =====================================================================================
 *
 *       Filename:  Proxy.cpp
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  2015年01月25日 00时43分53秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  LiuYi (), swliuyi@gmail.com
 *   Organization:  
 *
 * =====================================================================================
 */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <limits.h>
#include <iostream>
#include  <tr1/memory>
using namespace std;

class SchoolGirl
{
    private:
        string name;
    public:
        SchoolGirl(string n):name(n){}
        string GetName()
        {
            return name;
        }
};

class IGiveGift
{
    public:
        void virtual GiveDolls()=0;
        void virtual GiveFlowers()=0;
        void virtual GiveChocolate()=0;
};

class Pursuit : public IGiveGift
{
    private:
        SchoolGirl & mm;
    public:
        Pursuit(SchoolGirl & sc):mm(sc){}
        void GiveDolls()
        {
            cout<<mm.GetName()<<" Give you Dolls"<<endl;
        }
        void GiveFlowers()
        {
            cout<<mm.GetName()<<" Give you Flowers"<<endl;
        }
        void GiveChocolate()
        {
            cout<<mm.GetName()<<" Give you Chocolate"<<endl;
        }
};

class Proxy : public IGiveGift
{
    private:
        tr1::shared_ptr<Pursuit> gg;
    public:
        Proxy(SchoolGirl &mm):gg(new Pursuit(mm)){}
        void GiveDolls()
        {
            gg->GiveDolls();
        }
        void GiveFlowers()
        {
            gg->GiveFlowers();
        }
        void GiveChocolate()
        {
            gg->GiveChocolate();
        }
};

int main(int argc, char *argv[])
{
    SchoolGirl mm("jiaojiao");
    Proxy daili(mm);
    daili.GiveDolls();
    daili.GiveChocolate();
    daili.GiveFlowers();
}
